<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>05.参数默认值</title>
</head>
<body>

    <script>
        /**
         * 求两个数的和
         */

        //  function add(a,b) {
        //     b = b != 0 ? (b || 10) : 0
        //      console.log(a+b);
        //  }

         function add(a,b=10) {
      
             console.log(a+b);
         }


        // add(1,2)
         add(1)
         add(1,0)
         console.log("解构赋值赋值默认值...............");
         function fun({name,age,address="南京市"}) {
            console.log(name,age,address);
        }
        // fun("小明",18,"无锡市")
        const person = {
           name:"小明",
           age:18,
           address:"无锡市"
        }

        fun(person)


    </script>
    
</body>
</html>